package com.mall.db.api;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mall.db.mapper.OmsOrderSettingMapper;
import com.mall.pojo.OmsOrderSetting;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class OmsOrderSettingApiImpl implements OmsOrderSettingApi {

    @Autowired
    private OmsOrderSettingMapper omsOrderSettingMapper;

    /**
     * 根据指定id获取订单设置
     * @param id
     * @return
     */
    @Override
    public OmsOrderSetting findOrderSettingById(Integer id) {
     return omsOrderSettingMapper.selectById(id);
    }


    /**
     * 修改订单设置
     * @param orderSetting
     * @return
     */
    @Override
    public Integer updateOrderSetting(OmsOrderSetting orderSetting) {
        LambdaQueryWrapper<OmsOrderSetting> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(OmsOrderSetting::getId,orderSetting.getId());


        Integer updateNum = omsOrderSettingMapper.update(orderSetting, queryWrapper);


        return updateNum;
    }
}
